programming4us
           
 
 
Windows Server

Windows Server 2008 : Publishing Printers to Active Directory with pubprn.vbs

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
7/12/2013 7:46:49 PM

You can use the pubprn.vbs script to publish printers to Active Directory. pubprn.vbs is located in the c:\windows\system32\printing_admin_scripts\en-us folder.

Tip

For installations outside the U.S., you might not have the en-us folder. However, you can locate the pubprn.vbs file with this command from the root of C: dir pubprn.vbs /s.


The basic syntax is

[cscript]
c:\windows\system32\printing_admin_scripts\en-us\pubprn.vbs
[server | UNC-printer-path]"LDAP://DN"

The following table describes the different elements of the pubprn.vbs script.

pubprn Syntax ElementComments
cscript

cscript is the command-based script host used to execute the pubprn.vbs script file. When used, the output goes to the command prompt. If omitted, the output shows in dialog boxes.

Tip

While cscript is sometimes optional when running scripts from the command prompt, you should use it to get consistent results with the printer scripts. Some scripts run without it but other scripts do not.

c:\windows\system32\
printing_admin_scripts\
en-us

This is the path to the folder holding the pubprn.vbs file.

Note

Because this path is not known to Windows by default, you either need to include the path in the command or change the directory before executing the command. For example, you can change to the directory with the following command: cd \windows\system32\printing_admin_scripts\en-us.

Server | UNC-printer-
path

This is the name of a print server sharing one or more printers. If you omit the server name, the local computer is used. The Universal Naming Convention (UNC) path can be used to point to a specific printer on a server. If the UNC isn’t used, the command uses all shared printers on the target server.

Note

UNC paths have the format of \\server-name\share-name. In this case, the format is \\server-name\shared-printer-name.

LDAP://

LDAP:// must be entered exactly and with LDAP in uppercase.

Tip

This is one of the few times when the case of the command matters.

DN

This is the distinguished name (dn) of the OU where the printer will be published. For example, if you want to identify an OU named printers in the pearson.pub domain, use the following DN: ou=printers,dc=pearson,dc=pub. The path to the OU must exist or the command will fail.



For example, if you want to publish a single printer shared as Color_Laser on a server named DC2, in an OU named Printers in the pearson.pub domain, you can use the following command:

cscript
c:\windows\system32\printing_admin_scripts\en-us\pubprn.vbs
 \\dc2\color_laser "LDAP://ou=printers,dc=pearson,dc=pub"

When complete, the command shows the following output:

Published printer: LDAP://DC1.pearson.pub/CN=DC2-Color_Laser,
ou=printers,dc=pearson,dc=pub

Figure 1 shows the printer published into Active Directory Users and Computers from the preceding command.

Figure 1. Printer published from the pubprn.vbs script

Tip

The OU must exist in the domain for the command to work. You can add the OU using any method including the dsadd command: dsadd ou ou-dn.


If you want to publish all printers shared on a server named Print1 in an OU named Printers in the pearson.pub domain, you can use the following command:

cscript
c:\windows\system32\printing_admin_scripts\en-us\pubprn.vbs dc2
 "LDAP://ou=printers,dc=pearson,dc=pub"

You can also publish printers from the printer properties dialog box by selecting List in the Directory, as shown in Figure 2.

Figure 2. Publishing a printer by selecting List in the Directory

Other -----------------
- Windows Small Business Server 2011 : Deploying Network Printers (part 4) - Sharing a Printer
- Windows Small Business Server 2011 : Deploying Network Printers (part 3) - Creating a DHCP Reservation for a Printer
- Windows Small Business Server 2011 : Deploying Network Printers (part 2) - Installing a Network-Attached Printer, Installing a Network Printer Manually
- Windows Small Business Server 2011 : Deploying Network Printers (part 1) - Creating a Printer - Installing a Local Printer Manually
- Windows Small Business Server 2011 : Sharing Printers- Understanding Windows Printing
- Windows Home Server 2011 : Getting More Out of Control Panel (part 2) - Alternative Methods for Opening Control Panel Icons
- Windows Home Server 2011 : Getting More Out of Control Panel (part 1) - Understanding Control Panel Files
- Windows Home Server 2011 : Using the Local Group Policy Editor (part 3) - Increasing the Size of the Recent Documents List, Enabling the Shutdown Event Tracker
- Windows Home Server 2011 : Using the Local Group Policy Editor (part 2) - Customizing the Places Bar
- Windows Home Server 2011 : Using the Local Group Policy Editor (part 1) - Working with Group Policies, Customizing the Windows Security Screen
- Windows Server 2012 : Backup and Recovery (part 8) - Backing up and restoring Active Directory
- Windows Server 2012 : Backup and Recovery (part 7) - Backing up and recovering your data - Recovering data stored on another server, Recovering the system state
- Windows Server 2012 : Backup and Recovery (part 6) - Backing up and recovering your data - Tracking scheduled and manual backups, Recovering your data
- Windows Server 2012 : Backup and Recovery (part 5) - Backing up and recovering your data - Performing a one-time backup
- Windows Server 2012 : Backup and Recovery (part 4) - Backing up and recovering your data - Scheduling backups
- Windows Server 2012 : Backup and Recovery (part 3) - Backing up and recovering your data - Using the backup utility, Backing up your data
- Windows Server 2012 : Backup and Recovery (part 2) - Developing backup strategies
- Windows Server 2012 : Backup and Recovery (part 1) - Disaster-planning strategies, Disaster preparedness procedures
- Installing Windows Server 2012 and Server Core : Managing and Configuring a Server Core Installation
- Installing Windows Server 2012 and Server Core : Understanding Server Core Installation
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us